/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.List;

/**
* @website https://el-admin.vip
* @description /
* @author admin
* @date 2020-07-28
**/
@Entity
@Data
@Table(name="fh_comp_list")
public class FhCompList implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "企业名称")
    private String name;

    @Column(name = "legal_person",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "法人代表")
    private String legalPerson;

    @Column(name = "capital",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "注册资本")
    private String capital;

    @Column(name = "license_start_time",nullable = false)
    @NotNull
    @ApiModelProperty(value = "执照开始时间")
    private Timestamp licenseStartTime;

    @Column(name = "license_end_time",nullable = false)
    @NotNull
    @ApiModelProperty(value = "执照结束时间")
    private Timestamp licenseEndTime;

    @Column(name = "scale",nullable = false)
    @NotNull
    @ApiModelProperty(value = "规模")
    private Integer scale;

    @Column(name = "income",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "企业收入")
    private String income;

    @Column(name = "revenue",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "企业税收")
    private String revenue;

    @OneToOne
    @JoinColumn(name = "industry")
    @ApiModelProperty(value = "所属行业")
    private FhIndustryList industry;

    @Column(name = "enter_time",nullable = false)
    @NotNull
    @ApiModelProperty(value = "入驻时间  ")
    private Timestamp enterTime;

    @Column(name = "emphasis")
    @ApiModelProperty(value = "是否重点")
    private Integer emphasis;

    @Column(name = "supra")
    @ApiModelProperty(value = "是否规上")
    private Integer supra;


    @Column(name = "picture_str")
    @ApiModelProperty(value = "公司图片")
    private String pictureStr;

    @OneToOne
    @NotNull
    @JoinColumn(name = "info_floor")
    @ApiModelProperty(value = "所在楼")
    private FhInfoFloor infoFloor;

//    @OneToMany(fetch=FetchType.EAGER)
//    @JoinTable(name="fh_comp_picture",joinColumns={@JoinColumn(name="comp_id")}
//            ,inverseJoinColumns={@JoinColumn(name="picture_id")})
//    private List<LocalStorage> pictures;




    @Column(name = "level")
    @ApiModelProperty(value = "所在层")
    private Integer level;

    @Column(name = "doorplate")
    @ApiModelProperty(value = "门牌号")
    private String doorplate;

    @Column(name = "introduction")
    @ApiModelProperty(value = "公司简介")
    private String introduction;

    @Column(name = "staff_count")
    @ApiModelProperty(value = "员工数")
    private Integer staffCount = 0;

    @Column(name = "type")
    @ApiModelProperty(value = "类型")
    private Integer type;

    @Column(name = "sort_code")
    @ApiModelProperty(value = "排序码")
    private Integer sortCode = 0;

    public void copy(FhCompList source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}